#include <bits/stdc++.h>

using namespace std;
using ll = long long;

void solve()
{
    int n;
    cin >> n;
    string s;
    cin >> s;
    int count = 1;
    for (int i = 0; i < 2 * n; i++)
    {
        if (s[i] == ')')
        {
            if (count == 1)
            {
                cout << -1;
                return;
            }
            count--;
        }
        else
            count++;
    }
    int now = 0;
    for (int i = 0; i < s.size(); i++)
    {
        if (s[i] == '(')
            cout << n - (++now) << ' ';
        else --now;
    }
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t = 1;
    while (t--)
    {
        solve();
    }
    return 0;
}